package com.zdl.interestingapp.view

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.zdl.interestingapp.utils.MyNormalUtil

/**
 * @author zdl
 * @date 2018/4/20 15:28
 * email zdl328465042@163.com
 * description 所有activity的基类
 */
abstract class BaseActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        MyNormalUtil.log(this , "当前实例的类是：" + javaClass.simpleName)
        ActivityCollector.addActivity(this)

        initData()
        setListener()
        requestData()
    }

    override fun onDestroy() {
        super.onDestroy()
        ActivityCollector.removeActivity(this)
    }

    protected abstract fun initData()

    protected abstract fun setListener()

    open fun requestData(){}
}